package com.itheima;

import java.time.Instant;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.util.Date;

public class LocalDatetimeDemo08 {
    //时间戳转换
    public static void main(String[] args) {
        //获得instant对象，表示当前的一个时间点
        Instant instant = Instant.now();
        //    输出对象  2023-11-16T03:16:50.551Z
        System.out.println(instant);
        /**date 和 instant的互相转换
         *
         */
    //    instant----->date
        Date date = Date.from(instant);
        // Thu Nov 16 11:15:32 CST 2023
        System.out.println(date);
        //    date---->instant
        Instant instant1 = date.toInstant();
        //2023-11-16T03:16:50.551Z
        System.out.println(instant1);


    }
}
